From d726c576b00273da5291bbdc6dd50ae34de5f3e2 Mon Sep 17 00:00:00 2001 From: Stephen Becker IV Date: Sun, 17 May 2015 09:01:50 -0700 Subject: [PATCH] Update text per comment in pull request. Better error message with details around lib and bin. --- src/cargo/util/toml.rs | 5 +++-- tests/test_cargo_compile.rs | 4 +++- tests/test_cargo_compile_custom_build.rs | 4 +++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/cargo/util/toml.rs b/src/cargo/util/toml.rs index 5cbefe566..485cc5b09 100644 --- a/src/cargo/util/toml.rs +++ b/src/cargo/util/toml.rs @@ -118,8 +118,9 @@ pub fn to_manifest(contents: &[u8], None => {} } if !manifest.targets().iter().any(|t| !t.is_custom_build()) { - return Err(human(format!("either a [lib] (lib.rs) or [[bin]] (main.rs) section must \ - be present in src"))) + return Err(human(format!("no targets specified in the manifest \neither \ + src/lib.rs, src/main.rs, a [lib] section, or [[bin]] \ + section must be present"))) } return Ok((manifest, paths)); diff --git a/tests/test_cargo_compile.rs b/tests/test_cargo_compile.rs index aa18699dc..309f445dc 100644 --- a/tests/test_cargo_compile.rs +++ b/tests/test_cargo_compile.rs @@ -794,7 +794,9 @@ test!(missing_lib_and_bin { failed to parse manifest at `[..]Cargo.toml` Caused by: - either a [lib] (lib.rs) or [[bin]] (main.rs) section must be present in src\n")); + no targets specified in the manifest + + either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present\n")); }); test!(lto_build { diff --git a/tests/test_cargo_compile_custom_build.rs b/tests/test_cargo_compile_custom_build.rs index 51d184330..0a9789751 100644 --- a/tests/test_cargo_compile_custom_build.rs +++ b/tests/test_cargo_compile_custom_build.rs @@ -953,7 +953,9 @@ test!(build_script_only { failed to parse manifest at `[..]` Caused by: - either a [lib] (lib.rs) or [[bin]] (main.rs) section must be present in src")); + no targets specified in the manifest + + either src/lib.rs, src/main.rs, a [lib] section, or [[bin]] section must be present")); }); test!(shared_dep_with_a_build_script { -- 2.30.2